﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using xiaodingmarket_Domain_core;
using xiaodingmarket_Domain_core.Models;
using static xiaodingmarket_Domain.Models.EunmType;

namespace xiaodingmarket_Domain.Models
{
    public class Commodity: AggregateRoot
    {
        public Commodity()
        {

        }

        public Commodity(Guid id, Kind? kind, Category category, int wanter, int viewsCount, DateTime endtime, string remark, CommodityDetail commodityDetail,string wanterid, Commoditystate isreviewok, bool isDelete)
        {
            Id = id;
            Kind = kind;
            Category = category;
            this.wanter = wanter;
            ViewsCount = viewsCount;
            this.endtime = endtime;
            Remark = remark;
            CommodityDetail = commodityDetail;
            Wanterid = wanterid;
            State = isreviewok;
            IsDelete = isDelete;
        }

        /// <summary>
        /// 大分类（商品or悬赏）
        /// </summary>
        public Kind? Kind { get; set; }
        /// <summary>
        /// 品目分类
        /// </summary>
        public Category Category { get; set; }
        /// <summary>
        /// 想要人数（点击按钮后再从销售子域中获得具体想要者名单）
        /// </summary>
        public int wanter{ get; set; }
        /// <summary>
        /// 浏览次数)
        /// </summary>
        public int ViewsCount { get; set; }
        /// <summary>
        /// 设定的自动截止时间,普通商品默认为无期
        /// </summary>
        public DateTime? endtime { get; set; }
        /// <summary>
        /// 备注（用户自定义标签等）)
        /// </summary>
        [Column(TypeName = "varchar(500)")]
        public string Remark { get; set; }
        /// <summary>
        /// 详情
        /// </summary>
        public CommodityDetail CommodityDetail { get; set; }
        /// <summary>
        /// 想要者列表
        /// </summary>
        [Column(TypeName = "varchar(500)")]
        public string Wanterid { get; set; }
        /// <summary>
        /// 商品状态
        /// </summary>
        public Commoditystate State { get; set; }
        /// <summary>
        /// 逻辑删除
        /// </summary>
        [Required]
        public bool IsDelete { get; set; }
    }

}
